package com.aifast.crm.customer.controller;

import com.aifast.common.annotations.AiIdempotent;
import com.aifast.common.base.Controller;

import com.aifast.common.base.R;
import com.aifast.common.layui.LayuiDataTable;
import com.aifast.crm.customer.entity.CrmFollow;
import com.aifast.crm.customer.service.CrmFollowService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 客户跟进 控制层
 *
 * @author fujian
 * @date 2022-08-30
 */
@RequiredArgsConstructor
@RestController
@RequestMapping("/crm/follow")
public class CrmFollowController extends Controller {

    private final CrmFollowService service;

    @GetMapping("list")
    public LayuiDataTable list(CrmFollow crmFollow) {
        return service.list(crmFollow, getPage());
    }

    @AiIdempotent
    @PostMapping("add")
    public R add(CrmFollow crmFollow) {
        return service.insertOrUpdate(crmFollow) ? OK() : ERROR();
    }

    @AiIdempotent
    @GetMapping("del")
    public R del() {
        return service.del(getInt("id"), get("ids")) ? OK() : ERROR();
    }

    @GetMapping("info")
    public R info() {
        return service.info(getInt("id"));
    }


}
